<ion-view view-title=我的任务 >
  <ion-content>
    <ion-refresher on-refresh="doRefresh()"
                   pulling-text="下拉刷新..."
                   refreshing-text="拼命加载中..."
                   refreshing-icon="ion-loading-b">

    </ion-refresher>
      <div class="list card" ng-repeat="mymission in mymissions" href="#">
        <div class="item">
          <h2>{{mymission.area.areaName}}区-

            <span ng-if="(mymission.orderInfo.get('type') != 9)" style="color: red;">{{mymission.orderInfo.get('type') | orderTypeName}}</span>
            <span ng-if="(mymission.orderInfo.get('type') === 9)">商家外卖</span>
            <span ng-bind-html="mymission.orderid | colorString">
            </span>
            <a class="float-right" style=" color: orange" ng-click="goToFirst(mymission.orderid)">优先</a>
            <!--<span style="color: orange;">{{mymission.orderInfo.get('status') |  orderState }}</span>-->
          </h2>
        </div>
        <div class="item item-body">
          <p>
            <i class="icon ion-ios-home" style="font-size: x-large;color: orange;"></i>
            {{mymission.address.address}}
          </p>
          <!--<p>-->
            <!--收件人：{{mymission.address.name}} <a>{{mymission.address.phone}}</a>-->
          <!--</p>-->
          <!--<p ng-if="(mymission.orderInfo.get('type') != 9)">
            取件地址：{{mymission.shop.areaName}}
          </p>
          <p ng-if="(mymission.orderInfo.get('type') === 9)">
            取件地址：{{mymission.orderInfo.get('sellerName')}}&#45;&#45;{{mymission.orderInfo.get('storeName')}}
          </p>-->
          <p>
            <i class="icon ion-ios-people" style="font-size: x-large;color: orange;"></i>
            {{mymission.address.name}}
            <a href="tel:{{mymission.address.phone}}">{{mymission.address.phone}}</a>
            <a href="tel:{{mymission.address.phone}}" class="icon ion-ios-telephone"></a>
          </p>
          <!--<p>
          下单时间：{{mymission.orderInfo.createdAt | date : 'yyyy-MM-dd HH:mm:ss'}}
          </p>-->
          <p >
            <i class="icon ion-arrow-graph-up-right" style="font-size: x-large;color: orange;"></i>
           {{mymission.orderInfo.get('status') |  orderState }}
          </p>
          <p ng-if="mymission.bookdate !=undefined">
            预约时间：{{mymission.bookdate | date : 'yyyy-MM-dd HH:mm:ss'}}
          </p>
        </div>
        <div class="row ">
          <!-- mymission.orderInfo.get('status') === 7000-->
          <div class="col" ng-show="false">
            <button class="button button-balanced button-small button-block" ng-click="dispatching(event,mymission.orderid,mymission)">
              <i class="icon ion-ios-stopwatch-outline "></i>
              <b >开始派送</b>
            </button>
          </div>
          <div class="col" ng-show="mymission.orderInfo.get('status') === 8000 || mymission.orderInfo.get('status') === 7000">
            <button class="button button-assertive button-small button-block" ng-click="successfully(event,mymission.orderid,mymission)">
              <i class="icon ion-android-walk "></i>
              <b>完成派送</b>
            </button>
          </div>
          <div class="col">
            <button class="button button-calm button-small button-block" ng-click="gotoDetail(mymission.orderid)">
              <i class="icon ion-ios-book-outline "></i>
              <b>任务详情</b>
            </button>
          </div>
        </div>
        <!--<div class="item button-bar" >
          <a class="button" style="color:white;background-color: red" ng-show="mymission.orderStatus<0" ng-click="cancelMission(mymission.orderid)">取消</a>
          <a class="button" style="color:white;background-color: green" ng-click="gotoDetail(mymission.orderid)">开始派送</a>
          <a class="button" style="color:white;background-color: red" ng-click="gotoDetail(mymission.orderid)">完成派送</a>
          <a class="button " style="color:white;background-color: orange" ng-click="gotoDetail(mymission.orderid)">任务详情</a>
        </div>-->
      </div>
    <div ng-if="(mymissions.length == 0)" class="card">
      <div class="item item-text-wrap">
        啥都没有~去领任务吧。
      </div>
    </div>
    <div style="text-align: center" ng-if="(mymissions.length != 0)">
      <a style="color: green;text-align: center" ng-click="getMore()" >{{loadmore.more}}</a>
    </div>
  </ion-content>
</ion-view>
